1. Field of the Invention
The field of the invention is data processing, or, more specifically, methods, systems, and products for pretranslating input/output buffers in environments with multiple page sizes.
2. Description of Related Art
Many computer operating systems use a page-based virtual memory architecture where the operating system virtualizes a process's address space. Under this model, the operating system maps a virtual address in a process address space to a physical memory address on a system.
While virtual addressing can be used under most process and kernel contexts, when doing I/O to or from a memory buffer, the physical memory address of the buffer must be used if an I/O adapter wants to take advantage of direct memory access (‘DMA’). Thus, for every I/O, the operating system must translate the virtual addresses of a memory buffer into real addresses. For I/O-intensive applications, performing these translations at every I/O can be very expensive and can significantly impact an application's performance.
To help alleviate this problem, IBM's AIX™ operating system introduced the concept of pretranslating I/O buffers. When a memory buffer is going to be consistently used for I/O, an application, kernel extension, device driver, or other consumer of pretranslation information, can indicate that the buffer should be pretranslated. In this case, the operating system will translate all of the virtual addresses of the buffer to real addresses and save those real address translations (one real address for each page in the range). The operating system will then create a cookie for the memory buffer and store the list of real address translations for the memory buffer in the cookie or associate the list of real address translation for the memory buffer with the cookie, for example, through a pointer.
After a memory buffer has been pretranslated, its cookie is passed to consumers of pretranslation information when pages in the buffer need to be mapped or translated for DMA. Rather than call out to the kernel to translate virtual addresses for the buffer, the consumer will use the list of translated real addresses, that is, the pretranslations, in the buffer's cookie when establishing the mappings needed for DMA. To find the translation for a page in a pretranslation list, the bus device driver just computes an index into the list based on the page number of a page in the buffer.
While this method avoids having to do address translation lookup's on every I/O operation, it does not account for multiple page sizes. On systems using multiple page sizes, all pretranslations will be based on the smallest, base page size. Thus, on a system where 4K pages and 16M pages are being used, pretranslating a 16M results in 4096 pretranslations (one for each 4K chunk of the 16M page).
On large memory systems that heavily utilize larger page sizes, pretranslating everything in the base page size results in a large amount of wasted memory to store all of the extra, unneeded pretranlations. This wasted space significantly reduces the amount of memory that can be used by an application and can negatively impact performance. For example, in database workloads, the space wasted for these pretranslation lists reduces the amount of memory that can be used to cache data for the database in its buffer pools. In addition, more cache misses occur in accessing the pretranslations because the pretranslations are spread across a large amount of memory.